#!/bin/sh
# taken from rc.shutdown..

cd /
script="$(echo $0 | sed 's|.*/||')"

MOUNTED=`tac /proc/mounts | grep -vE '/dev |/dev/root | rootfs | / | usbfs | aufs | tmpfs ' | cut -f2 -d' '`
STRAY_MOUNTPOINTS=`echo "$MOUNTED" | grep -vE '/proc|/sys|/initrd|/dev |/dev/pts'`
for MOUNT_POINT in $STRAY_MOUNTPOINTS ; do
  echo "Unmounting $MOUNT_POINT"
  umount -r "$MOUNT_POINT"
done
umount -ar &>/dev/null

# terminate
busybox $script -f #reboot -f

### END ###
